layui.use(['form', 'layer', 'jquery'], function () {
    // 操作对象
    var form = layui.form;
    var $ = layui.jquery;
    form.on('submit(login)', function (data) {
        // console.log(data.field);
        $.ajax({
            url: '/doLogin',
            data: data.field,
            dataType: 'json',
            type: 'post',
            success: function (data) {
                if (data.code == "00000") {
                    console.log("hello world")
                    location.href = "/index";
                } else {
                    layer.msg(data.message);
                }
            }
        })
        return false;
    })

});


if (window != top) {
    top.location.href = location.href;
}